public class Student {
    public String name;
    public String gender;
    private int age;
    private double score;
    public static String classRoom="三栋305";//教室属于每个学生对象共享 但又不属于任何一个对象 用static修饰为静态成员变量

    public Student(String name, String  gender, int age, double score) {
        this.name = name;
        this.gender = gender;
        this.age = age;
        this.score = score;
    }
    public static void main(String[] args) {
        System.out.println(Student.classRoom);//静态成员变量通过类名访问
        Student stu1=new Student("张三","男",18,4.5);
        Student stu2=new Student("李四","男",19,3.9);
        Student stu3=new Student("王五","女",20,4.8);
        System.out.println(stu1.classRoom);//静态成员变量可通过每个对象访问
        System.out.println(stu2.classRoom);//静态成员变量由三个对象共享
        System.out.println(stu3.classRoom);

    }


}
